<script lang="ts">
import type { Ref } from 'vue'
import { defineComponent, ref, toRefs, unref } from 'vue'
import { prefixCls } from '@/settings/designSetting'
import { createAppProviderContext } from './useAppContext'

export default defineComponent({
  name: 'AppProvider',
  inheritAttrs: false,
  props: {
    prefixCls: { type: String, default: prefixCls },
  },
  setup(props, { slots }) {
    const isMobile = ref(false)
    const { prefixCls }: { prefixCls: Ref<string> } = toRefs(props)

    createAppProviderContext({ prefixCls, isMobile })
    return () => slots.default?.()
  }
})
</script>
